import hashlib
import os

def get_sha1(f):
    xd = open('C:/1.txt', 'rb').read()
    gys = xd
    os.remove('C:/1.txt')
    sha1 = hashlib.sha1(gys)
    osv = sha1.hexdigest()
    print(osv)
    bx = bytes(osv, encoding='utf-8')
    with open('C:/1.abc', 'wb') as f:
        f.write(bx)

get_sha1('')